#ifndef _FACING_H_
#define	_FACING_H_

#include "math/vec2.h"
namespace math
{

// handling turning around. All angles are in degrees
class	Facing
{
public:
					Facing(float	TurnSpeed = 180.0f, float InitialAngle = 0.0f);
					~Facing();
	void			Tick(float dt);
	void			SetCurrent(float f);
	void			SetTarget(float f);
	float			GetAngle() const { return m_CurrentAngle; };
	float			GetSpeed() const { return m_TurnSpeed; };
	void			SetTurnSpeed(float f) { m_TurnSpeed = f; };
	math::Vec2		GetForward() const ;
	math::Vec2		GetRight() const ;
	math::Vec2		GetForwardW2H() const;	// for rendering to screen; compensates for width/height ratios
	float			GetRemainder() const;
	void			SetSnap(bool b) { m_EnableSnap = b; };
	bool			GetSnap() const { return m_EnableSnap; };

	static float	AngleFromTo(const math::Vec2& From, const math::Vec2& To);
	static float	AngleVector(const math::Vec2& Dir);
	static math::Vec2	VectorFromAngle(float Angle);
	static float	AngleBetweenVectors(const math::Vec2& V1, const math::Vec2& V2);
	static float	FindDeltaAngle(float from, float to);

private:
	float			m_CurrentAngle;
	float			m_TargetAngle;
	float			m_TurnSpeed;
	bool			m_EnableSnap;
};


}
#endif //_FACING_H_